<template>
	<view class="editdata">
		<view class="nav">
			<uni-nav-bar leftWidth="750rpx" left-icon="back" leftText="编辑资料" @clickLeft="back"></uni-nav-bar>
		</view>
		<view class="space"></view>
		<view class="list">
			<view @click="header('bottom')" class="list-first_">

				<text>头像</text>
				<view class="list-second">
					<image src="https://cdn3.axureshop.com/demo/1989398/images/%E6%88%91%E7%9A%84_1/u758.svg"></image>
					<uni-icons type="right" size="20"></uni-icons>
				</view>
			</view>
			
			<view @click="rname" class="list-first">
				<text>昵称</text>
				<view class="list-second">
					<view>{{list.name}}</view>
					<uni-icons type="right" size="20"></uni-icons>
				</view>
			</view>
			<view class="list-first">
				<text>花花号</text>
				<view class="list-second">
					<view>{{list.userid}}</view>
					<uni-icons type="right" size="20"></uni-icons>
				</view>
			</view>
			<view @click="rsex" class="list-first">
				<text>性别</text>
				<view class="list-second">
					<view>{{list.sex}}</view>
					<uni-icons type="right" size="20"></uni-icons>
				</view>
			</view>
			<view @click="resume" class="list-first">
				<text>个人简介</text>
				<view class="list-second">
					<view>{{list.resum}}</view>
					<uni-icons type="right" size="20"></uni-icons>
				</view>
			</view>

		</view>

		<uni-popup ref="popup" background-color="#fff">
			<!-- <view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }">
					<text>popup 内容</text>
				</view> -->
			<view class="popup">

				<view class="popupcont" @click="camera">拍照</view>
				<view class="popupcont" @click="album">相册</view>

			</view>
		</uni-popup>

		<view>
			<!-- 输入框示例 -->
			<uni-popup ref="nameinput" type="dialog">
				<uni-popup-dialog ref="inputClose" mode="input" title="输入昵称" value="" placeholder="请输入内容"
					@confirm="namedialogInputConfirm"></uni-popup-dialog>
			</uni-popup>
		</view>
		<view>
			<!-- 输入框示例 -->
			<uni-popup ref="resumeinput" type="dialog">
				<uni-popup-dialog ref="inputClose" mode="input" title="输入简介" value="" placeholder="请输入内容"
					@confirm="resumedialogInputConfirm"></uni-popup-dialog>
			</uni-popup>
		</view>
		<view>
			<!-- 输入框示例 -->
			<uni-popup ref="sexinput" type="dialog">
				<uni-popup-dialog ref="inputClose" mode="input" title="输入性别" value="" placeholder="请输入内容"
					@confirm="sexdialogInputConfirm"></uni-popup-dialog>
			</uni-popup>
		</view>

	</view>
</template>

<script>
	import http from '@/utils/http.js'
	export default {
		data() {
			return {
				imageUrl: "http://mnxc.xyz:8080/common/download?name=",
				image: '',
				se: 0,
				imageStyles: {
					width: 64,
					height: 64,
					border: {
						radius: '50%'
					}
				},


				list: {
					userid: '56326',
					avaitor: '',
					name: '23',
					sex: '女',
					resum: '123456',

				}
			}
		},
		onshow() {
			this.showpage()
			// let s=uni.getStorageSync('usermessage')
		},
		methods: {

			back() {
				uni.navigateTo({
					url: '/pages/mine/personaldata/personaldata'
				})
			},
			//信息展示
			showpage() {

			},
			//头像
			header(type) {

				this.type = type
				this.$refs.popup.open(type)

				// uni.chooseImage({ //选择图片
				// 	success: (chooseImageRes) => {//得到选择图片的路径
				// 		console.log(chooseImageRes)
				// 		const tempFilePaths = chooseImageRes.tempFilePaths;
				// 		uni.uploadFile({
				// 			url: ``, //就是一个前后台接口
				// 			filePath: tempFilePaths[0],
				// 			name: 'file', //图片或者文件的名字
				// 			success: (uploadFileRes) => {
				// 				console.log(uploadFileRes.data);
				// 			}
				// // 		});
				// 		// http({
				// 		// 	url:
				// 		// })
				// 	}
				// });
			},
			//昵称修改
			// namer(){
			// 	this.$refs.nameinput.open()
			// },
			camera() {
				uni.chooseImage({
					count: 1, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['camera'], //使用相机
					success: (chooseImageRes) => {
						const tempFilePaths = chooseImageRes.tempFilePaths;
						uni.uploadFile({
							url: 'http://mnxc.xyz:8080//common/upload?type=?' + 2,
							filePath: tempFilePaths[0],
							name: 'userid',

							success: (uploadFileRes) => {
								console.log(uploadFileRes.data);
							}
						});
					}

				});
			},
			album() {
				uni.chooseImage({
					count: 1, //默认1
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success: (chooseImageRes) => {
						const tempFilePaths = chooseImageRes.tempFilePaths
						let files = {
							uri: tempFilePaths[0],
							file: chooseImageRes.tempFiles[i],
							type: 2
						}
						uni.uploadFile({
							url: 'http://mnxc.xyz:8080/common/upload?type=?',
							files: files,
							success: (uploadFileRes) => {
								console.log(uploadFileRes.data);
							}
						})
					},

				})
			},		
			rname() {
						console.log('123')
						// this.$refs.nameinput.open()
						// console.log('123')
			},
			namedialogInputConfirm(val) {
			
				setTimeout(() => {
					uni.hideLoading()
					console.log(val)
					this.list.name = val
			
					//this.list.name ='3333'
			
					//console.log(this.list.name)
					http({
			
						url: `/user`,
						method: 'PUT',
						data: {
							avatar: 37,
							//   "avatarPath": "",
							//   "code": "",
							//   "createTime": "",
							//   "deleted": 0,
							//description: '你好',
							nickName: val,
							// "updateTime": "",
							userAge: 100,
							userId: 1,
							// "userPWD": "",
							// "userSex": 0,
							// "useremail": "",
							// "version": 0
						},
					})
			
			
				})
			
				console.log(val)
				// uni.setStorageSync()
			
			
			},
			//个人简介修改
			resume() {
				this.$refs.resumeinput.open()
			},
			resumedialogInputConfirm(val) {
			
				setTimeout(() => {
					uni.hideLoading()
					//console.log(val)
					this.list.resum = val
			
					//console.log(this.list.resum)
					// uni.setStorageSync()
					http({
			
			
						url: `/user`,
						method: 'PUT',
						data: {
							avatar: 37,
							//   "avatarPath": "",
							//   "code": "",
							//   "createTime": "",
							//   "deleted": 0,
							description: val,
							//nickName:this.name ,
							// "updateTime": "",
							//userAge: 10,
							userId: 1,
							// "userPWD": "",
							// "userSex": 0,
							// "useremail": "",
							// "version": 0
						},
						success: (res) => {
							console.log('合适的')
						}
			
					})
					//console.log(this.list.resum)
					// console.log('15')
				})
			},
			//性别修改
			rsex() {
				this.$refs.sexinput.open()
			},
			sexdialogInputConfirm(val) {
				setTimeout(() => {
					uni.hideLoading()
					console.log(val)
					this.list.sex = val
					console.log(this.list.sex)
				})
				if (this.list.sex == '男') {
					this.se = 1
				}
				// uni.setStorageSync()
				http({
					url: `/user`,
					method: 'PUT',
					data: {
						avatar: 37,
						userId: '1',
						userSex: this.se,
					},
					success: (res) => {
						console.log('合适的')
					}
			
				})
			},
		}
	}
</script>

<style>
<<<<<<< HEAD
	.editdata {
		margin-top: 0;
	}

	.nav {
		margin-top: 40rpx;
		height: 100rpx;
		width: 750rpx;
		display: flex;
		align-items: center;
	}

	.space {
		height: 20rpx;
		background: #eee;
	}

	.list {
		margin-left: 5rpx;
		/* margin-top: 5rpx; */
		box-shadow: 0 0 0 2px #eee;

	}

	.list-first_ {
		box-shadow: 0 0 0 2px #eee;
		height: 200rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.list-first {
		box-shadow: 0 0 0 2px #eee;
		height: 100rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.list-second {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 28rpx;
		font-family: "楷体";

	}

	.list text {
		padding-left: 10rpx;

	}

	.list image {
		height: 100rpx;
		width: 100rpx;
	}

	.popup {
		height: 200rpx;
		background: #cccccc;
	}

	.popupcont {
		display: flex;
		justify-content: center;
		align-items: center;
		height: 100rpx;
		background: #ffffff;
		border-bottom-color: #939393;
		text-align: center;
	}
=======
.editdata{
	margin-top: 0;
}
.nav{
	margin-top: 40rpx;
	height: 100rpx;
	width: 750rpx;
	display: flex;
	align-items: center;
}
.space{
	height: 20rpx;
	background: #eee;
}
.list{
	margin-left: 5rpx;
	/* margin-top: 5rpx; */
	box-shadow: 0 0 0 2px #eee;
	
}
.list-first_{
	box-shadow: 0 0 0 2px #eee;
	/* width: 300rpx; */
	/* background-color: pink; */
	height: 200rpx;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.list-first{
	box-shadow: 0 0 0 2px #eee;
	height: 100rpx;
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.list-second{
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 28rpx;
	font-family: "楷体";
	
}
.list text{
	padding-left: 10rpx;
	
}
.list image{
	height: 100rpx;
	width: 100rpx;
}
.popup{
	height: 200rpx;
	background: #cccccc;
}
.popupcont{
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100rpx;
	background: #ffffff;
	border-bottom-color: #939393;
	text-align: center;
}
>>>>>>> 4ea720424237d040576ac4692915ebdfca47b567
</style>
